<?php

namespace app\controllers;

use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\Response;
use yii\filters\VerbFilter;
use app\models\LoginForm;
use app\models\ContactForm;
use app\models\EntryForm;
use app\models\Users;

class DemoController extends Controller
{
    //渲染注册页面
    public function actionAdd(){
        return $this->render("add");
    }
    //注册添加
    public function actionAdddo(){
        //接值
        $data=Yii::$app->request->post();
//        print_r($data);
//        die();
        //实例化
        $model = new Users();
//        print_r($model);die();
        $model->username=$data['username'];
        $model->userpwd=$data['userpwd'];
        $model->tel=$data['tel'];
        $model->email=$data['email'];
//        if(!$model->validate()){
//            echo "请填写未填写信息";
//        }

        //判断
        $res=$model->addData($data);
        if($res){
            echo "添加成功";
        }else{
            echo "添加失败";
        }

    }
}


?>